package sv.edu.edutec.fotos.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import sv.edu.edutec.fotos.dao.PhotoDAO;
import sv.edu.edutec.fotos.model.TblComment;
import sv.edu.edutec.fotos.model.TblPhoto;
import sv.edu.edutec.fotos.model.TblUser;

@Service
public class PhotoServiceImpl implements PhotoService {
	
	@Autowired
	PhotoDAO photoDAO;
	
	@Transactional
	public void addPhoto(TblPhoto photo) {
		// TODO Auto-generated method stub
		photoDAO.addPhoto(photo);
	}

	@Transactional
	public void editPhoto(TblPhoto photo) {
		// TODO Auto-generated method stub
		photoDAO.editPhoto(photo);

	}

	@Transactional
	public void deletePhoto(Integer photoId) {
		// TODO Auto-generated method stub
		photoDAO.deletePhoto(photoId);

	}

	@Transactional
	public List<TblPhoto> listPhotos() {
		// TODO Auto-generated method stub
		return photoDAO.listPhotos();
	}

	@Transactional
	public TblPhoto findPhoto(Integer photoId) {
		// TODO Auto-generated method stub
		return photoDAO.findPhoto(photoId);
	}

	@Transactional
	public void addComment(TblComment comment) {
		// TODO Auto-generated method stub
		photoDAO.addComment(comment);
	}

	@Transactional
	public List<TblComment> listComments() {
		// TODO Auto-generated method stub
		return photoDAO.listComments();
	}

	@Transactional
	public List<TblComment> listComments(String hql) {
		// TODO Auto-generated method stub
		return photoDAO.listComments(hql);
	}

	@Transactional
	public List<TblUser> listUsers(String hql) {
		// TODO Auto-generated method stub
		return photoDAO.listUsers(hql);
	}

	
}
